require 'crawler/blogger_crawler'

conditions = nil
conditions = ARGV[0] unless ARGV[0].nil?

crawler = Crawler::BloggerCrawler.new({
  :conditions => conditions, 
  :stop_crawling? => lambda  {|c| c.status == 302},
  :min_dealy => 32,
  :max_delay => 74 })

p crawler

log = {:stopped => true}

begin
  log = crawler.start_crawling {|c| p c}
  if log[:stopped] then
    delay = 60*60
    p "Time to sleep #{delay}sec"
    sleep delay
  end
end while (log[:stopped])

puts "Finis #{log}"